<?php

abstract class Diagram {
    private $transitions;
    private $states;
    private $actions;
    private $events;
    private $guards;

    public function  __construct($file) {
        $this->transitions = array();
        $this->states = array();
        $this->actions = array();
        $this->events = array();
        $this->guards = array();
        $this->parse($file);
    }

    public function getTransitions(){
        return $this->transitions;
    }

    public function getStates(){
        return $this->states;
    }

    public function getActions(){
        return $this->actions;
    }

    public function getEvents(){
        return $this->events;
    }

    public function getGuards(){
        return $this->guards;
    }

    protected function addTransition(Transition $transition){
        $this->transitions[] = $transition;
    }

    protected function addState(State $state){
        $this->states[] = $state;
    }

    protected function addAction(Action $action){
        $this->actions[] = $action;
    }

    protected function addEvent(Event $event) {
        $this->events[] = $event;
    }

    protected function addGuard($guard) {
        $this->guards[] = $guard;
    }

    protected abstract function parse($file);
}

?>
